package owl2vowl.model.entities.nodes;

import owl2vowl.model.SetWithoutNull;
import owl2vowl.model.entities.AbstractEntity;
import owl2vowl.model.entities.nodes.HasComplement;
import owl2vowl.model.entities.nodes.HasIntersections;
import owl2vowl.model.entities.nodes.HasUnions;
import owl2vowl.model.entities.nodes.classes.VowlThing;
import java.util.Collections;
import java.util.Set;
import org.semanticweb.owlapi.model.IRI;

public abstract class AbstractNode extends AbstractEntity implements HasUnions, HasIntersections, HasComplement {
	private Set<IRI> complements = new SetWithoutNull();
	private Set<IRI> intersectionElements = new SetWithoutNull();
	private Set<IRI> unionElements = new SetWithoutNull();
	private Set<IRI> inGoingProperties = new SetWithoutNull();
	private Set<IRI> outGoingProperties = new SetWithoutNull();

	protected AbstractNode(IRI iri, String type) {
		super(iri, type);
	}

	public Set<IRI> getInGoingProperties() {
		return this.inGoingProperties;
	}

	public Set<IRI> getOutGoingProperties() {
		return this.outGoingProperties;
	}

	public Set<IRI> getComplements() {
		return Collections.unmodifiableSet(this.complements);
	}

	public void addComplement(IRI iri) {
		if (!iri.equals(VowlThing.GENERIC_THING_IRI)) {
			this.complements.add(iri);
		}
	}

	public void addElementToIntersection(IRI iri) {
		if (!iri.equals(VowlThing.GENERIC_THING_IRI)) {
			this.intersectionElements.add(iri);
		}
	}

	public Set<IRI> getElementOfIntersection() {
		return Collections.unmodifiableSet(this.intersectionElements);
	}

	public void addElementToUnion(IRI iri) {
		if (!iri.equals(VowlThing.GENERIC_THING_IRI)) {
			this.unionElements.add(iri);
		}
	}

	public Set<IRI> getElementsOfUnion() {
		return Collections.unmodifiableSet(this.unionElements);
	}

	public void addInGoingProperty(IRI property) {
		this.inGoingProperties.add(property);
	}

	public void addOutGoingProperty(IRI property) {
		this.outGoingProperties.add(property);
	}
}